﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;

namespace SpringGraphExample.Web.ProxyService
{
    /// <summary>
    /// Summary description for ProxyService
    /// </summary>
    public class ProxyService : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            var url = context.Request.Params["reqUrl"];

            WebClient client = new WebClient();
            var stream = client.OpenRead(url);

            context.Response.ContentType = "text/plain";
            stream.CopyTo(context.Response.OutputStream);
            context.Response.OutputStream.Flush();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}